package com.portal4kids.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

@Entity
@Table(name = "places")
public class Places implements Serializable{
	private static final long serialVersionUID = 3089069640431222656L;
	private int id_place;
	private String type = "none";
	private String name = "none";
	private String adress = "none";
	private String description = "none";
	private int rating = 0;
	private int avarage = 0;
	private int numberOfVotes = 0;
	private String comments ="none";
	private List<PlacesAttribute> atributes;
	
	@Id
    @GeneratedValue
	public int getId_place() {
		return id_place;
	}
	public void setId_place(int id_place) {
		this.id_place = id_place;
	}
	
	@OneToMany(cascade={CascadeType.ALL})
	@JoinColumn(name="id_attribute")
	public List<PlacesAttribute> getAtributes() {
		return atributes;
	}
	public void setAtributes(List<PlacesAttribute> atributes) {
		this.atributes = atributes;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		if(!type.isEmpty())
			this.type = type;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		if(!name.isEmpty())
			this.name = name;
	}
	public String getAdress() {
		return adress;
	}
	public void setAdress(String adress) {
		if(!adress.isEmpty())
			this.adress = adress;
	}
	@Column(name="description", length=10000)
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		if(!description.isEmpty())
			this.description = description;
	}
	public int getRating() {
		return rating;
	}
	public void setRating(int rating) {
		if(rating > 0.0)
			this.rating = rating;
	}
	public int getNumberOfVotes() {
		return numberOfVotes;
	}
	public void setNumberOfVotes(int numberOfVotes) {
		if(numberOfVotes > 0)
			this.numberOfVotes = numberOfVotes;
	}
	public String getComments() {
		return comments;
	}
	public void setComments(String comments) {
		this.comments = comments;
	}
	public int getAvarage() {
		return avarage;
	}
	public void setAvarage(int avarage) {
		if(avarage > 0.0)
			this.avarage = avarage;
	}
	
	

}
